package com.smartcampusbackend.mapper;

import com.smartcampusbackend.model.Announcement;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;

@Mapper
public interface AnnouncementMapper {
    int insertAnnouncement(Announcement announcement);
    Announcement selectAnnouncementById(@Param("id") Integer id);
    List<Announcement> selectAnnouncements(@Param("type") String type, @Param("publisher") String publisher);
    List<Announcement> selectAnnouncementsWithSearch(@Param("type") String type, @Param("publisher") String publisher, 
                                                    @Param("keyword") String keyword, @Param("offset") Integer offset, @Param("size") Integer size);
    int selectAnnouncementsCount(@Param("type") String type, @Param("publisher") String publisher, @Param("keyword") String keyword);
    int updateActivityStatus(@Param("id") Integer id, @Param("status") String status);
    int deleteAnnouncement(@Param("id") Integer id);
    
    // 草稿相关方法
    List<Announcement> selectDrafts(@Param("publisher") String publisher, @Param("type") String type);
    int updateAnnouncement(Announcement announcement);
    int publishDraft(@Param("id") Integer id, @Param("publishTime") java.util.Date publishTime);
} 